
import lang from "./conf/Lang.js";
import cmd from "./Cmd.js";
import goPage from "./GoPage.js";
import https from "./https/Https.js";
var tabBarConntrl = {};
/***页面跳转**/
tabBarConntrl.gotoReLaunch = function(url)
{
	uni.reLaunch({
		url : url,
	})
}

/**切换账号**/
tabBarConntrl.switchAccount = function()
{
	lang.switchAccount(callBack,true);
	async function callBack(res)
	{
		if(res && res.confirm)
		{
			let res = https.logout();
			uni.clearStorageSync();
			goPage.gotoReLaunch(goPage.LOGIN_PAGE);
		}
	}
}

tabBarConntrl.close = function()
{

	lang.exit(callBack,true);
	let _this = this
	async function callBack(res){
		if(res && res.confirm){
			// cmd.external(cmd.CMD_LOGOUT);
			https.logout({},back);
			console.log("TabBarContrl.js = res =",res)
			function back(data){
				console.log("dataxxx--=",data)
				if(data?.status == 1){
					uni.clearStorageSync();
					// _this.$store.commit("setLogOut");
					goPage.gotoReLaunch(goPage.LOGIN_PAGE);
				}
			}
		}
	}
}

export default tabBarConntrl;
